package common.util;

import org.javatuples.*;

/**
 * ClassName: Tuples
 * Function:
 * <p>
 * Tuple helper to create numerous items of tuple. the maximum is 10.
 * if you want to create tuple which elements count  more than 10, a new class would be a better choice.
 * if you don't want to new a class, just extends the class {@link org.javatuples.Tuple} and do your own implemention.
 * </p>
 * date: 23/10/2015 10:39
 *
 * @version 1.0.0
 * @author xmliu
 * @since JDK 1.8
 */
public class Tuples {

	/**
	 * <p>Create a tuple of one element.</p>
	 *
	 * @param value0
	 * @param <A>
	 *
	 * @return a tuple of one element
	 *
	 * @date 23/10/2015 10:46
	 * @author xmliu
	 */
	public static <A> Unit<A> of(final A value0) {

		return Unit.with(value0);
	}

	/**
	 * <p>Create a tuple of two elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param <A>
	 * @param <B>
	 *
	 * @return a tuple of two elements
	 *
	 * @date 23/10/2015 10:48
	 * @author xmliu
	 */
	public static <A, B> Pair<A, B> of(final A value0, final B value1) {

		return Pair.with(value0, value1);
	}

	/**
	 * <p>Create a tuple of three elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 *
	 * @return a tuple of three elements
	 *
	 * @date 23/10/2015 10:49
	 * @author xmliu
	 */
	public static <A, B, C> Triplet<A, B, C> of(final A value0, final B value1, final C value2) {

		return Triplet.with(value0, value1, value2);
	}

	/**
	 * <p>Create a tuple of four elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 *
	 * @return a tuple of four elements
	 *
	 * @date 23/10/2015 10:54
	 * @author xmliu
	 */
	public static <A, B, C, D> Quartet<A, B, C, D> of(final A value0, final B value1, final C value2, final D value3) {

		return Quartet.with(value0, value1, value2, value3);
	}

	/**
	 * <p>Create a tuple of five elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 *
	 * @return a tuple of five elements
	 *
	 * @date 23/10/2015 10:55
	 * @author xmliu
	 */
	public static <A, B, C, D, E> Quintet<A, B, C, D, E> of(final A value0, final B value1, final C value2, final D value3, final E value4) {

		return Quintet.with(value0, value1, value2, value3, value4);
	}

	/**
	 * <p>Create a tuple of six elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param value5
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 * @param <F>
	 *
	 * @return a tuple of six elements
	 *
	 * @date 23/10/2015 10:55
	 * @author xmliu
	 */
	public static <A, B, C, D, E, F> Sextet<A, B, C, D, E, F> of(final A value0, final B value1, final C value2, final D value3, final E value4, final F value5) {

		return Sextet.with(value0, value1, value2, value3, value4, value5);
	}

	/**
	 * <p>Create a tuple of seven elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param value5
	 * @param value6
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 * @param <F>
	 * @param <G>
	 *
	 * @return a tuple of seven elements
	 *
	 * @date 23/10/2015 10:55
	 * @author xmliu
	 */
	public static <A, B, C, D, E, F, G> Septet<A, B, C, D, E, F, G> of(final A value0, final B value1, final C value2, final D value3, final E value4, final F value5, final G value6) {

		return Septet.with(value0, value1, value2, value3, value4, value5, value6);
	}

	/**
	 * <p>Create a tuple of eight elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param value5
	 * @param value6
	 * @param value7
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 * @param <F>
	 * @param <G>
	 * @param <H>
	 *
	 * @return Create a tuple of eight elements
	 *
	 * @date 23/10/2015 10:56
	 * @author xmliu
	 */
	public static <A, B, C, D, E, F, G, H> Octet<A, B, C, D, E, F, G, H> of(final A value0, final B value1, final C value2, final D value3, final E value4, final F value5, final G value6,
			final H value7) {

		return Octet.with(value0, value1, value2, value3, value4, value5, value6, value7);
	}

	/**
	 * <p>Create a tuple of nine elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param value5
	 * @param value6
	 * @param value7
	 * @param value8
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 * @param <F>
	 * @param <G>
	 * @param <H>
	 * @param <I>
	 *
	 * @return a tuple of nine elements
	 *
	 * @date 23/10/2015 10:56
	 * @author xmliu
	 */
	public static <A, B, C, D, E, F, G, H, I> Ennead<A, B, C, D, E, F, G, H, I> of(final A value0, final B value1, final C value2, final D value3, final E value4, final F value5, final G value6,
			final H value7, final I value8) {

		return Ennead.with(value0, value1, value2, value3, value4, value5, value6, value7, value8);
	}

	/**
	 * <p>Create a tuple of ten elements.</p>
	 *
	 * @param value0
	 * @param value1
	 * @param value2
	 * @param value3
	 * @param value4
	 * @param value5
	 * @param value6
	 * @param value7
	 * @param value8
	 * @param value9
	 * @param <A>
	 * @param <B>
	 * @param <C>
	 * @param <D>
	 * @param <E>
	 * @param <F>
	 * @param <G>
	 * @param <H>
	 * @param <I>
	 * @param <J>
	 *
	 * @return a tuple of ten elements
	 *
	 * @date 23/10/2015 10:56
	 * @author xmliu
	 */
	public static <A, B, C, D, E, F, G, H, I, J> Decade<A, B, C, D, E, F, G, H, I, J> of(final A value0, final B value1, final C value2, final D value3, final E value4, final F value5, final G value6,
			final H value7, final I value8, final J value9) {

		return Decade.with(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9);
	}

}
